<template>
  <div class='container'>
    <el-dialog
      :visible="dialogVisible"
      title="预览文章"
      width="800px"
      @close="onClose">
      <h2>{{ previewRow.title }}</h2>
      <p>{{ new Date(previewRow.createTime) | parseTime }} {{ previewRow.username }} <i class='el-icon-view'></i>
        {{ previewRow.visits }}</p>
      <div class="dashed" v-html='previewRow.articleBody'></div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'articles-preview',
  props: {
    dialogVisible: {
      type: Boolean,
      required: true
    },
    previewRow: {
      type: Object,
      required: true
    }
  },
  methods: {
    onClose () {
      this.$emit('update:dialogVisible', false)
    }

  }
}
</script>

<style lang='less' scoped>

.container {
  .dashed {
    border-top: 2px dashed #ccc;
    background-color: #f5f5f5;

    img {
      width: 100px;
    }
  }
}
</style>
